package controler.userCommands;
import controler.A_State;
import controler.A_UserCommand;

/**
 * ...
 * @author Damien Mabin
 */

class AddNewElement<T> extends A_UserCommand
{

	private var m_Class		:Class<T>;
	private var m_Elt 		: T;
	
	public function new(_NextState:A_State, _Class:Class<T>, _Elt:T) 
	{
		super(_NextState);
		m_CanBeUndo = true;
		m_Stackable = false;
		m_Class = _Class;
		m_Elt = _Elt;
	}
	
	override public function DoCommand():Void 
	{
		super.DoCommand();
		A_UserCommand.s_Model.CTRL_AddNewElement(m_Class, m_Elt);
	}
	
	override public function UndoCommand():Void 
	{
		A_UserCommand.s_Model.CTRL_DeleteElement(m_Class, m_Elt);
		super.UndoCommand();
	}
	
}